<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#div1{
				width:100px;
				height:100px;
				background: red;
				position:absolute;
				top:50px;
				left:150px;
			}
		</style>
		<script>
			window.onload = function(){
				var oDiv = document.getElementById("div1");
				var speed = 10;
//				计时器的使用
				setInterval(function(){
//					1,获取div1原来的 left值,offsetLeft;
					var old_left = oDiv.offsetLeft;
	//				2,累计速度获得新left值
					var new_left = old_left + speed;
	//				3,将新的left值,写入div1的行内样式,让其运动
					oDiv.style.left = new_left + 'px';
					
				},1000/60);
//				
			}
		</script>
	</head>
	<body>
		<div id="div1">111</div>
	</body>
</html>
